Check Working Hours
What does it do?
Checks if the current time is within defined working hours. Routes to on_complete during working hours and on_failure outside of them. Sets userState.workingHours (boolean) for backward compatibility.
There are three variants:
checkWorkingTime— checks the bot-levelworking_timeconfig, with optionaltypeparam to filter by schedule namecheckDepartmentWorkingTime— checks a specific department's working hours by department ID (usesfunc_type: department)checkWorkingHours(legacy) — same behavior ascheckWorkingTimeusing the older function name
1. checkWorkingTime
Syntax
<node_name>:
type: func
func_type: system
func_id: checkWorkingTime
params:
type: <schedule_name>
on_complete: <on working time node>
on_failure: <outside working time node>
must include at bot level:
working_time:
<schedule_name>:
<start day>-<end day>: <start time>-<end time>
required params
typetype of the nodefunc_typehere it will be a system functionfunc_idwhat function are we calling (checkWorkingTime)on_completenext node if it is working hourson_failurenext node if it is not working hours
optional params
params.typeselects a named working time schedule (when multiple are defined)departmentassigns the chat to a departmentagentassigns the chat to a specific agent (email address or CRM ID as defined in the Texter agents manager)
2. checkDepartmentWorkingTime
Syntax
<node_name>:
type: func
func_type: department
func_id: checkWorkingTime
params:
department: "<department_id>"
on_complete: <on working time node>
on_failure: <outside working time node>
required params
typetype of the nodefunc_typemust bedepartmentfunc_idwhat function are we calling (checkWorkingTime)params.departmentthe department ID whose working hours to checkon_completenext node if the department is in working hourson_failurenext node if the department is not in working hours
optional params
agentassigns the chat to a specific agent (email address or CRM ID as defined in the Texter agents manager)
3. checkWorkingHours (Legacy)
Syntax
<node_name>:
type: func
func_type: system
func_id: checkWorkingHours
on_complete: <on working time node>
on_failure: <outside working time node>
Same behavior as checkWorkingTime but uses the older function name. Prefer checkWorkingTime for new bots.
4. working_time Schedule Format
The bot-level working_time config maps schedule names to day/time rules.
Day key formats
| Format | Example | Result |
|---|---|---|
| Single day | fri | Friday only |
| Comma list | sun, tue, thu | Sunday, Tuesday, Thursday |
| Range (ascending) | mon-fri | Monday through Friday |
| Range (wrap-around) | sat-mon | Saturday, Sunday, Monday |
| Mixed | sun-thu, sat | Sunday–Thursday plus Saturday |
Abbreviations are supported and case-insensitive: su/sun/sunday, mo/mon/monday, tu/tue/tuesday, we/wed/wednesday, th/thu/thursday, fr/fri/friday, sa/sat/saturday.
Time value formats
| Format | Example | Result |
|---|---|---|
| Single range | 08:00-17:00 | One continuous block |
| Multiple ranges | 08:00-12:00, 13:00-17:00 | Two blocks (e.g. lunch break) |
| Minutes optional | 8-17 | Same as 08:00-17:00 |
Example with mixed formats
working_time:
office:
sun-thu: 08:00-17:00
fri: 08:00-14:00
support:
sun, tue: 09:00-13:00
mon, wed-fri: 10:00-12:00, 14:00-16:00
5. Examples
Basic working hours check
# Bot-level config:
working_time:
office:
sun-thu: 09:00-18:00
fri: 09:00-14:00
check_working_hours:
type: func
func_type: system
func_id: checkWorkingTime
on_complete: main_menu
on_failure: outside_working_hours
Named schedules (multiple departments)
# Bot-level config:
working_time:
office:
sun-thu: 08:00-17:00
fri: 08:00-14:00
home_department:
sun-thu: 19:00-20:00
influencer:
sun-thu: 09:00-13:00
check_working_hours_home:
type: func
func_type: system
func_id: checkWorkingTime
params:
type: home_department
on_complete: main_menu
on_failure: outside_working_hours
Check a department's working hours
check_support_hours:
type: func
func_type: department
func_id: checkWorkingTime
params:
department: "64a1b2c3d4e5f6a7b8c9d0e1"
on_complete: route_to_support
on_failure: outside_support_hours
Check before handoff (common pattern)
check_working_hours:
type: func
func_type: system
func_id: checkWorkingTime
on_complete: during_working_hours
on_failure: outside_working_hours
during_working_hours:
type: notify
messages:
- "תודה"
- "ניצור קשר בהקדם האפשרי 🙂"
on_complete: handoff
outside_working_hours:
type: notify
messages:
- "תודה"
- "קיבלנו את פנייתך, נחזור אליך בהקדם בשעות הפעילות"
- ""
- "אנו פעילים בימים א-ה בין השעות 9:00 ועד 18:00"
- "ובימי ו' וערבי חג בין השעות 9:00 ועד 14:00"
on_complete: handoff
Full week schedule
working_time:
office:
sun-sat: 09:30-18:30
Without params.type, the first schedule (typically office) is used by default. Use params.type to select a specific named schedule.
The customer's default timezone is used when evaluating working hours.
The legacy func_id checkWorkingHours still works but checkWorkingTime is the canonical name. Use checkWorkingTime for new bots.